The present invention relates generally to computer systems, and more specifically, to an isolated program execution environment for a computer system.
When applying a transactional model into a JavaScript™ platform, JavaScript program code may be compiled and executed repeatedly within an execution environment. When multiple transactions are performed within a shared execution environment, this shared execution environment may be contaminated for future transactions by a transaction. In order to avoid such contamination, after running a JavaScript program within an execution environment, the environment may be restored back to a pristine state. This may be achieved by providing a dedicated execution environment for every transaction. For example, the execution environment may be structured as a separate process that runs each individual JavaScript program. The separate process is created, the JavaScript program is executed, and then the process and memory resources are cleaned up after execution has completed. However, provision of such individual processes may be relatively costly in terms of memory and performance. Another alternative is to use a snapshot-like mechanism. In this approach, a snapshot is taken to record the environment state either before or during execution of a transaction, and the environment is restored after the transaction completes based on the snapshot. For example, if a transaction places an asynchronous call, a snapshot may be taken and another program is be placed into the runtime. However, such an approach may not be feasible in a system that executes multiple simultaneous transactions asynchronously.